<extend name="default/template/base_20160803" />
<block name="area_header">
	<link rel="stylesheet" href="__PUBLIC__/Webview/css/viewpage/dapeigou.css?v2"/>
	<link rel="stylesheet" href="__PUBLIC__/Webview/js/dropload/0.9.0/dropload.css"/>
	<script type="text/javascript" src="__PUBLIC__/Webview/js/dropload/0.9.0/dropload.min.js"></script>
</block>
<block name="area_body">
	<div class="content">
		<div class="package-wrap">
			<volist name="package_info.list" id="vo">
				<div class="product1">
					<a class="alpha-btn" href="com.moodwo.mengwu://?type=MENGWU_PRODUCT_PACKAGE&packageid={$vo.id}"></a>
					<div class="main-pic"><img src="{:C('PICTURE_REMOTE_URL')}{$vo.package_img}&size=400"></div>
					<span class="mid">{$vo.package_name}</span>
					<div class="time mid">
						{$vo.create_time|date='Y.m.d',###}更新
					</div>
					<p>{$vo.package_desc}</p>
					<ul>
						<li><div class="item-pic"><notempty name="vo.detail.items.0.img_id"><img src="{:C('PICTURE_REMOTE_URL')}{$vo.detail.items.0.img_id}&size=120"></notempty></div></li>
						<li><div class="item-pic"><notempty name="vo.detail.items.1.img_id"><img src="{:C('PICTURE_REMOTE_URL')}{$vo.detail.items.1.img_id}&size=120"></notempty></div></li>
						<li><div class="item-pic"><notempty name="vo.detail.items.2.img_id"><img src="{:C('PICTURE_REMOTE_URL')}{$vo.detail.items.2.img_id}&size=120"></notempty></div></li>
						<li><span>{$vo.package_price}￥</span></li>
					</ul>
				</div>
			</volist>
		</div>
	</div>
</block>
<block name="area_footer">
	<script type="text/javascript">
		$(function(){
			var counter = 2;
			// 每页展示10个
			var num = 10;

			// dropload
			$('.content').dropload({
				scrollArea : window,
				loadDownFn : function(me){
					$.ajax({
						type: 'POST',
						url: "{:U('webview/viewPage/querydpg')}",
						data:{curpage:counter,size:num},
						dataType: 'json',
						success: function(data){

							if(data.status){
								var result = '';
								counter++;
								var list = data.info.list;

								for(var i = 0; i < list.length; i++){
									var _url = "{:C('PICTURE_REMOTE_URL')}";
									var _main_pic = _url+list[i].package_img+"&size=400";
									var _date = new Date(parseInt(list[i].create_time)*1000);
									var _img1 = parseFloat(list[i].detail.items[0].img_id) ? '<img src="'+_url+list[i].detail.items[0].img_id+'&size=120">' : '';
									var _img2 = parseFloat(list[i].detail.items[1].img_id) ? '<img src="'+_url+list[i].detail.items[1].img_id+'&size=120">' : '';
									var _img3 = parseFloat(list[i].detail.items[2].img_id) ? '<img src="'+_url+list[i].detail.items[2].img_id+'&size=120">' : '';
									var _m = _date.getMonth()+1>9 ? _date.getMonth()+1 : '0'+(_date.getMonth()+1);
									var _d = _date.getDate()+1>9 ? _date.getDate()+1 : '0'+(_date.getDate()+1);
									_date = _date.getFullYear() + '.' + _m + '.' +_d;
									result += '<div class="product1"> ' +
											'<a class="alpha-btn" href="com.moodwo.mengwu://?type=MENGWU_PRODUCT_PACKAGE&packageid="'+list[i].id+'></a> ' +
											'<div class="main-pic"><img src="'+_main_pic+'"></div> ' +
											'<span class="mid">'+list[i].package_name+'</span> ' +
											'<div class="time mid">'+_date+'更新 </div> ' +
											'<p>'+list[i].package_desc+'</p> ' +
											'<ul> ' +
											'<li><div class="item-pic">'+_img1+'</div></li> ' +
											'<li><div class="item-pic">'+_img2+'</div></li> ' +
											'<li><div class="item-pic">'+_img3+'</div></li> ' +
											'<li><span>'+list[i].package_price+'￥</span></li> ' +
											'</ul> ' +
											'</div>';
								}

								if(counter*num >= data.info.count){
									// 锁定
									me.lock();
									// 无数据
									me.noData();
								}

								$('.package-wrap').append(result);
								// 每次数据加载完，必须重置
								me.resetload();

							}

						},
						error: function(xhr, type){
							alert('Ajax error!');
							// 即使加载出错，也得重置
							me.resetload();
						}
					});
				}
			});
		});
	</script>

</block>